// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from "axios";
/*引入ElementUI的标签(组件)*/
import ElementUI from 'element-ui';
/*引入ElementUI的样式*/
import 'element-ui/lib/theme-chalk/index.css';
import {getCookie} from "@/assets/js/cookieUtil";

/*设置axios模块默认访问的域名代理名称*/
axios.defaults.baseURL="/shop";
/*定义请求体提的参数格式*/
axios.defaults.headers.post['Content-type'] ="application/json";
/*设置全局配置axios的变量为$http*/
Vue.prototype.$http = axios;


//Vue.prototype.$msg = localStorage.getItem("msg");

/*全局配置ElementUI*/
Vue.use(ElementUI);

/*自定义权限指令*/
Vue.directive("power",{
  bind:function (el,binding) {
      //获取cookie的角色信息
      const roleName = getCookie("role");
      console.log("roleName="+roleName);
      if (roleName!="管理员"){
        //不显示html元素
        el.style.display = 'none';
      }
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
